import abc
from typing import Any


class BaseUser(metaclass=abc.ABCMeta):
    """Base user class defining common attributes and methods for all users"""
    
    def __init__(self, ID: str, Password: str, role: str):
        """Initialize basic user information"""
        self.ID = ID
        self.__Password = Password  # Private attribute to protect password
        self.role = role  # Attribute name changed to lowercase 'role'
    
    @abc.abstractmethod
    def view_dashboard(self) -> str:
        """Abstract method: View user dashboard, different implementations for different roles"""
        pass
    
    def authenticate(self, password: str) -> bool:
        """Verify if password is correct"""
        return self.__Password == password
    
    def change_password(self, old_password: str, new_password: str) -> bool:
        """Change password"""
        if self.authenticate(old_password):
            self.__Password = new_password
            return True
        return False
    
    def reset_password(self) -> None:
        """Reset password to default value '123456'"""
        self.__Password = "123456"
    
    @property
    def Password(self) -> str:
        """Get password (for system internal use only)"""
        return self.__Password
    
    @abc.abstractmethod
    def to_dict(self) -> dict[str, Any]:
        """Convert user information to dictionary for data persistence"""
        return {
            "id": self.ID,
            "password": self.__Password,
            "role": self.role  # Attribute name changed to lowercase 'role'
        }